﻿@using CkSoftware.GroupMe.Sdk.TestWeb.Helpers
@using CkSoftware.GroupMe.Sdk.TestWeb.Models
@using TwitterBootstrapMVC.Controls
@model CreateGroupModel
@{
    ViewBag.Title = "Create new group";
}

<div class="page-header">
    <h1>Create new group</h1>
</div>

@if (!SessionConfiguration.IsConfigValueIsSet<string>(SessionConfiguration.GroupMeClientAuthKey))
{
    <h2>Configuration required</h2>
    <p>Before you can start here, you have to configure your GroupMe Access Token @Html.Bootstrap().ActionLink("here", "Index").</p>
}
else
{
    <p>On this page, you can create a new group using the GroupMe .NET SDK.</p>

    using (FormBuilder<CreateGroupModel> form = Html.Bootstrap().Begin(new Form("CreateGroup").Type(FormType.Horizontal)))
    {
        @form.ControlGroup().TextBoxFor(m => m.GroupName).Label().LabelText("Group name")
        @form.ControlGroup().TextAreaFor(m => m.Description).Label().LabelText("Description")
        @form.ControlGroup().TextBoxFor(m => m.GroupImageUrl).Label().LabelText("Group image URL")
        @form.ControlGroup().CheckBoxFor(m => m.OpenForSharing).Label().LabelText("Open for sharing").ShowRequiredStar(false)
        @form.ControlGroup().CustomControls(Html.Bootstrap().SubmitButton())
    }
}